﻿namespace Outlook.WorkItems.Extension.Addin.Actions
{
    public class UntrackWorkItemAction : IBowieAction
    {
        private readonly OutlookItem _outlookItem;

        public UntrackWorkItemAction(OutlookItem item)
        {
            _outlookItem = item;
        }

        #region IBowieAction Members

        public void Do()
        {
            var relatedWorkItemsId = _outlookItem.ItemProperties["RelatedWIIds"];

            if (relatedWorkItemsId != null)
            {
                relatedWorkItemsId.Value = null;
                _outlookItem.Save();
            }
        }

        #endregion
    }
}
